#define _CRT_SECURE_NO_WARNINGS  1

class Solution {
public:
    int MoreThanHalfNum_Solution(vector<int>& numbers)
    {
        int n = numbers.size() / 2;
        if (n % 2 == 0)
        {
            n = numbers.size() / 2;
        }
        else
        {
            n = n - 1;
        }
        int count = 1;
        for (int i = 0; i < numbers.size(); i++)
        {
            count = 1;
            for (int j = i; j < numbers.size(); j++)
            {
                if (numbers[i] == numbers[j + 1])
                {
                    count++;
                }
            }
            if (count > n)
                return numbers[i];
        }
        return 0;
    }
};